home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / O.Z / O
Encoding:
Text File  |  1998-10-28  |  3.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      OOOO((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))          OOOO((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       O - Generic interface    to Perl    Compiler backends
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           perl -MO=Backend[,OPTIONS] foo.pl
  13.  
  14.  
  15.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.       This is the module that is used as a frontend    to the Perl
  17.       Compiler.
  18.  
  19.      CCCCOOOONNNNVVVVEEEENNNNTTTTIIIIOOOONNNNSSSS
  20.       Most compiler    backends use the following conventions:
  21.       OPTIONS consists of a    comma-separated    list of    words (no
  22.       white-space).     The -v    option usually puts the    backend    into
  23.       verbose mode.     The -ofile option generates output to ffffiiiilllleeee
  24.       instead of stdout. The -D option followed by various letters
  25.       turns    on various internal debugging flags. See the
  26.       documentation    for the    desired    backend    (named B::Backend for
  27.       the example above) to    find out about that backend.
  28.  
  29.      IIIIMMMMPPPPLLLLEEEEMMMMEEEENNNNTTTTAAAATTTTIIIIOOOONNNN
  30.       This section is only necessary for those who want to write a
  31.       compiler backend module that can be used via this module.
  32.  
  33.       The command-line mentioned in    the SYNOPSIS section
  34.       corresponds to the Perl code
  35.  
  36.           use O ("Backend",    OPTIONS);
  37.  
  38.       The import function which that calls loads in    the
  39.       appropriate B::Backend module    and calls the compile function
  40.       in that package, passing it OPTIONS. That function is
  41.       expected to return a sub reference which we'll call
  42.       CALLBACK. Next, the "compile-only" flag is switched on
  43.       (equivalent to the command-line option -c) and an END    block
  44.       is registered    which calls CALLBACK. Thus the main Perl
  45.       program mentioned on the command-line    is read    in, parsed and
  46.       compiled into    internal syntax    tree form. Since the -c    flag
  47.       is set, the program does not start running (excepting    BEGIN
  48.       blocks of course) but    the CALLBACK function registered by
  49.       the compiler backend is called.
  50.  
  51.       In summary, a    compiler backend module    should be called
  52.       "B::Foo" for some foo    and live in the    appropriate directory
  53.       for that name.  It should define a function called compile.
  54.       When the user    types
  55.  
  56.           perl -MO=Foo,OPTIONS foo.pl
  57.  
  58.       that function    is called and is passed    those OPTIONS (split
  59.       on commas). It should    return a sub ref to the    main
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      OOOO((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))          OOOO((((3333))))
  71.  
  72.  
  73.  
  74.       compilation function.     After the user's program is loaded
  75.       and parsed, that returned sub    ref is invoked which can then
  76.       go ahead and do the compilation, usually by making use of
  77.       the B    module's functionality.
  78.  
  79.      AAAAUUUUTTTTHHHHOOOORRRR
  80.       Malcolm Beattie, mbeattie@sable.ox.ac.uk
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.